home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 101-125 / scopedisk106 / bbs-index / bbsindex.doc < prev    next >
Text File  |  1995-03-19  |  37KB  |  802 lines

  1.  
  2.                 BBSINDEX -- generates BBS-PC! file listings
  3.  
  4.                  (C) Copyright Eddy Carroll, December 1989
  5.  
  6.  
  7. INTRODUCTION
  8.  
  9.     BBSindex is a utility for use with the BBS-PC! bulletin board package.
  10.     It reads in the UDHEAD.DAT file database and allows you to list its
  11.     contents in a wide variety of ways. It has its own script language
  12.     which allows great control over the output produced.
  13.  
  14.     BBSindex can perform the following operations on the file database:
  15.  
  16.       - Sort the files into order by Name, Size, Date or any other field
  17.       - Select files matching specified criteria
  18.       - Print file lists, using a user specified format string
  19.       - Determine which files are currently present in the download dirs
  20.       - List files that are in the download dirs but not the database
  21.  
  22.     The script language allows you to combine these to perform tasks such
  23.     as the following:
  24.  
  25.       - Produce file lists similar to those produced with the BBS-PC!
  26.         catalogue command, but sorted into any order. For example, BBS-PC!
  27.         won't let you list all the files in a given directory sorted into
  28.         alphabetical order. BBSindex will. With BBSindex, such lists can
  29.         be generated automatically and regularly (e.g. daily), and made
  30.         available to the BBS users through a menu item. The same file can
  31.         be locally uploaded into the file section for users to download.
  32.  
  33.       - Produce a list of files on and off line, just like BBS-PC!'s ChkFile
  34.         utility. In addition, BBSindex can spot files which are online but
  35.         which have a filesize different to that in the file catalogue. Such
  36.         files are most likely corrupt.
  37.  
  38.       - Build AmigaDOS batch files to perform maintenance tasks, such as
  39.         moving all the files in a particular section from whatever disk
  40.         directories they are currently located in into a new directory, or
  41.         moving all the files which are in the BBS-PC! download directories
  42.         but are NOT in the file catalogue to somewhere else.
  43.  
  44.     Without further ado, let's move on to the program itself.
  45.  
  46.  
  47. USAGE
  48.  
  49.     The command template for bbsindex looks like this:
  50.  
  51.         bbsindex {options} scriptfile ...
  52.  
  53.     You must always specify at least one script file to be executed. If
  54.     BBSindex can't find the file you asked for, it will look for a
  55.     similarly named one with a .SCR suffix. If you specify several files,
  56.     BBSindex will execute them in sequence as if they were a single
  57.     continuous file. Any settings, open files etc. are maintained across
  58.     multiple script files. This can be both a help and a hinderance; if
  59.     you are careful not to make scripts to reliant on default settings,
  60.     you shouldn't have any problems.
  61.  
  62.     BBSindex allows you to change some of its default settings via command
  63.     line options. These can all be changed via script commands as well,
  64.     but it is sometimes convenient to be able to alter them independently of
  65.     the script. The available options are listed below. Note that for those
  66.     options that take a parameter, there must be a space between the option
  67.     letter and the parameter.
  68.  
  69.     -c filename
  70.         This option allows you to specify the name of the configuration
  71.         file BBSindex should read to locate BBS-PC!'s download directories.
  72.         By default, it looks for the file CFGINFO.DAT in the current
  73.         directory. If you are running BBSindex from a directory other than
  74.         BBS-PC's home directory, you may need to use this option.
  75.  
  76.     -d filename
  77.         This option lets you specify the name of the file in which BBS-PC!
  78.         stores all the information about its file database. By default,
  79.         BBSindex will look for the file UDHEAD.DAT in the current directory.
  80.  
  81.     -f "string"
  82.         This option lets you change the format string used when outputting
  83.         file listings. See the discussion of the FORMAT command for a full
  84.         explanation of what to use here.
  85.  
  86.     -h
  87.         This prints out a brief help screen listing the command line
  88.         options.
  89.  
  90.     -n
  91.         This option stops BBSindex from putting up AmigaDOS requesters
  92.         (such as "Please insert volume FOO: in any drive"). It can be
  93.         useful if some of the BBS download directories are not currently
  94.         mounted, and BBSindex tries to access them.
  95.  
  96.     -s
  97.         This option causes any OPEN or APPEND commands to be ignored,
  98.         resulting in all output going to the screen. This is useful for
  99.         seeing the output from a script that normally goes to a disk file.
  100.  
  101.     -t
  102.         This option enables trace mode, which is useful for debugging large
  103.         scripts. Before each command in the script is executed, it is
  104.         printed to the screen. See the discussion of the TRACE command for
  105.         more information on the output produced, and its usefulness.
  106.  
  107.     An alternative method of running BBSindex is provided, to make it
  108.     possible to setup a menu option within BBS-PC! which will invoke
  109.     BBSindex automatically. This can be done using menu function 111
  110.     (Run External Program). However, BBS-PC! doesn't allow parameters to be
  111.     passed to programs started in this manner. To get around this, BBSindex
  112.     can be renamed to BBscript. When it is run as BBscript, it ignores any
  113.     command line parameters and instead looks for a script file called
  114.     BBSindex.scr in the current directory. This is particularly useful if
  115.     you are running the system remotely, and don't have easy access to the
  116.     local keyboard.
  117.  
  118.     There are a few things to look out for. You should run BBSindex in the
  119.     same directory as BBS-PC!'s CFGINFO.DAT and UDHEAD.DAT files (unless you
  120.     override these defaults with -c and -d, or via the appropriate script
  121.     commands). In addition, if you want BBSindex to know which files are
  122.     online and valid, you need to give the CHECKFILES command in the script.
  123.     This deliberate step is needed because checking all the files can take
  124.     some time on a large system, and is not always required. You should also
  125.     ensure that your CLI stack size is set to around 10000 or so. If
  126.     BBSindex runs out of stack, it will tell you so; restart it with a
  127.     larger stack.
  128.  
  129.     BBSindex needs a lot of memory to run -- around 300K altogether when
  130.     processing a 200K database. This is because the entire database file is
  131.     kept in memory while processing. Of course, people with a 200K file
  132.     database are likely to have extra memory as well, so this shouldn't be
  133.     a huge problem, though it may prevent you from running BBSindex from
  134.     within BBS-PC!. In any case, BBSindex doesn't crash when it runs out
  135.     of memory, it prints an error message, frees up all its resources and
  136.     exits cleanly. It does likewise if you press CTRL-C, which can be used
  137.     to abort at almost any time. (Sorting can't be interrupted, because the
  138.     overhead of checking for CTRL-C would make it significantly slower.
  139.     Sorts are pretty quick anyway, since they are done completely in memory).
  140.  
  141.     By now, you're probably wondering what actually goes into the script
  142.     file that BBSindex interprets. The next section describes this in
  143.     detail. You can also look at the example script files which accompany
  144.     BBSindex for a few ideas. Try running them with the -s option to make
  145.        them send output to the screen.
  146.  
  147.  
  148. SCRIPT FILES
  149.  
  150.     A script file is simply a standard text file which contains a list
  151.     of BBSindex commands to be executed. It is similar to a standard
  152.     AmigaDOS batch file, though quite a bit more flexible in its layout.
  153.  
  154.     You normally put one command on each line (blank lines are fine of
  155.     course), but you can have multiple commands on a single line if you
  156.     seperate them with a semicolon (`;'). Commands are case insensitive
  157.     (everything is converted to uppercase internally). You can build up
  158.     extra long command lines by ending each physical line with `\'. The
  159.     following newline will then be ignored, and the command continued
  160.     on the next line. Anything after a `#' to the end of a line is
  161.     treated as a comment.
  162.  
  163.     Many commands take parameters. Multiple parameters are seperated
  164.     by commas or spaces. If you want to include spaces or lowercase
  165.     characters in a parameter (usually the case), you need to surround it
  166.     with quotes. You can use either single or double quotes; if you use
  167.     single quotes, the string inside can contain double quotes and vice
  168.     versa.
  169.  
  170.     BBSindex allows you to define constants, which can then be used later
  171.     on as part of a command. It can be useful to assign items subject to
  172.     change (such as output filenames) to constants at the start of the
  173.     script file, and to use these constants throughout the rest of the file.
  174.     Changing a filename then becomes a simple matter of altering the
  175.     constant definition, rather than having to hunt through the script file.
  176.  
  177.     You define a constant by saying
  178.  
  179.         name = value
  180.  
  181.     where name is any identifier up to 20 characters, and value is a
  182.     single string. If value is surrounded by quotes, they are stripped off,
  183.     but the case of the text inside is retained. To use the constant, you
  184.     just say $(name) anywhere in a command, even within quotes. Any `$'
  185.     character which isn't immediately followed by an open parenthesis is
  186.     left unchanged.
  187.  
  188.     For example, you might say at the start of a script
  189.  
  190.         Filename = "Sys:BBS/Amiga.Files"
  191.  
  192.     and then later on, you could use it to open a file:
  193.  
  194.         OPEN $(Filename)
  195.  
  196.     As with everything else, constant names are case insensitive.
  197.  
  198.  
  199. SCRIPT COMMANDS
  200.  
  201.     This section contains a list of the commands recognised by BBSindex. If
  202.     you make an error in a script, you'll get an error message listing the
  203.     name of the script file, the line the error occurred on, and a brief
  204.     explanatory message.
  205.  
  206.     To start with, here's a brief synopsis of all the commands. Below this,
  207.     each command is described in detail.
  208.  
  209.     Command Name        Description
  210.     ~~~~~~~~~~~~        ~~~~~~~~~~~
  211.     APPEND "name"       Append future output to the end of file "name"
  212.     CHECKFILES          Scan BBS-PC!'s file directories
  213.     CLOSE               Close current output file, reverting to screen
  214.     CONFIG "name"       Specify full pathname to access the CFGINFO.DAT file
  215.     DATABASE "name"     Specify full pathname to access the UDHEAD.DAT file
  216.     ECHO "string"       Output "string" to the current output file
  217.     EXEC "command"      Execute an AmigaDOS command
  218.     FOREIGN             List all the files not in BBS-PC's file catalogue
  219.     FORMAT "string"     Specify the format to print file listings in
  220.     IGNORE file ...     Specify files to ignore when doing CHECKFILES
  221.     LIST                List all the files matching the SELECT criteria
  222.     MACRO name/ENDM     Define a new macro called name
  223.     MSG "string"        Display "string" on the screen
  224.     NOREQUEST           Stop AmigaDOS putting up error requesters
  225.     OPEN "name"         Direct future output to file "name"
  226.     RESET               Reset the file counters used by SCAN and LIST
  227.     SCAN                Update counters as LIST, but don't print any output
  228.     SELECT criteria     Specify criteria to use when listing files
  229.     SORT index ...      Sort database under the specified fields
  230.     TRACE [ON | OFF]    Turn on or off trace mode
  231.  
  232.  
  233. APPEND Filename
  234.  
  235.     Opens an existing file as the current output file. Any output from
  236.     BBSindex will be appended to the end of this file, until it is closed.
  237.     When no file is open, output goes to the screen. If a file is already
  238.     open when this command is given, then it will be closed before the
  239.     new file is opened.
  240.  
  241.  
  242. CHECKFILES [dir1, dir2, ...]
  243.  
  244.     Causes the BBS-PC! file directories on the local disk to be scanned,
  245.     so that it can determine which files are online and which are not. It
  246.     also compares the size of each file in the catalogue with its size on
  247.     disk, and if the two are different, sets the invalid flag for that file.
  248.     This is a reasonable indication that the file may be corrupt.
  249.  
  250.     CHECKFILES need only be done if you want to use the %f, %i, %p or %v
  251.     options of FORMAT, or you want to use the FOREIGN command. A single
  252.     CHECKFILES checks all the files, so it need only be done once. Future
  253.     occurances of CHECKFILES are ignored.
  254.  
  255.     By default, BBSindex looks in the CFGINFO.DAT file to find out the
  256.     location of the BBS-PC! file directories. CFGINFO.DAT should be in the
  257.     current directory, unless the -c option has been given to specify a
  258.     different location for it.
  259.  
  260.     If you give a list of directories to CHECKFILES, then these directories
  261.     are scanned instead of those in CFGINFO.DAT, and the latter doesn't
  262.     need to be accessed.
  263.  
  264.  
  265. CLOSE
  266.  
  267.     Closes the current file (if any) for output. Any future output gets
  268.     sent to the screen. It is not necessary to specifically close files
  269.     when you are finished with them (unless you really do want the output
  270.     to start being displayed on the screen) since BBSindex will close
  271.     files automatically when it exits.
  272.  
  273.  
  274. CONFIG "filename"
  275.  
  276.     Tells BBSindex where to find the BBS-PC! configuration file, which
  277.     contains the directory paths for the upload/download file directories.
  278.     This file is only accessed if you give a CHECKFILES command and don't
  279.     specify any directories; if you don't intend doing a CHECKFILES, you
  280.     don't need to worry about BBSindex being able to find the configuration
  281.     file. By default, BBSindex looks for the file CFGINFO.DAT in the
  282.     current directory.
  283.  
  284.     Be careful to specify the full filename of the configuration file,
  285.     not just the directory name.
  286.  
  287.  
  288. DATABASE "filename"
  289.  
  290.     Tells BBSindex where to find the BBS-PC! file database. The commands
  291.     CHECKFILES, SORT, LIST and SCAN will all cause the file database to be
  292.     read in. The DATABASE command can be given at any stage before this.
  293.     Afterwards, it has no effect. If you don't give a DATABASE command,
  294.     then the file UDHEAD.DAT in the current directory is used.
  295.  
  296.  
  297. ECHO "string" [NOLINE]
  298.  
  299.     Outputs "string" to the current file, or if no output file is open, to
  300.     the screen. "string" can contain any of the escape characters (such
  301.     as `\n') listed under FORMAT. It can also contain any of the following
  302.     special symbols:
  303.  
  304.         %b      The number of bytes used by files printed by the last LIST
  305.         %k      The number of Kilobytes used by files printed by last LIST
  306.         %m      The number of Megabytes used by files printed by last LIST
  307.         %n      The number of files printed by the last LIST command
  308.         %d      Today's day (Monday for example)
  309.         %t      Today's time
  310.         %ux     Creates underline, see FORMAT for more details
  311.         %w      Today's date (01-Jan-90 for example)
  312.         %{...}  Formats substring, see FORMAT for more details
  313.  
  314.     %B, %K, %M and %N are also available; these are similar to %b, %k,
  315.     %m and %n, but they are the sums for all the files printed since the
  316.     last RESET command, rather than the last LIST command. This allows you
  317.     to keep a running count of the total number of files printed in the
  318.     system.
  319.  
  320.     By default, a newline is automatically output after the string. This
  321.     can be suppressed by including the NOLINE parameter.
  322.  
  323.  
  324. EXEC "command"
  325.  
  326.     Executes the specified AmigaDOS command. The output from the command is
  327.     directed into the current output file. If you don't want this to happen,
  328.     you can specify redirection to NIL: as part of the command string. For
  329.     example
  330.  
  331.         EXEC "makedir >nil: ram:t"
  332.  
  333.     will try and make a directory in RAM:, and if it fails, you won't see
  334.     anything. The EXEC command can be particularly useful if you've just
  335.     used the FORMAT command in conjunction with LIST to generate an AmigaDOS
  336.     script file -- you can then do
  337.  
  338.         EXEC "Execute Scriptfile"
  339.  
  340.     and the script file will be executed on the spot. If you do this,
  341.     remember to close the script file you've just generated before you try
  342.     to execute it.
  343.  
  344.  
  345. FOREIGN
  346.  
  347.     Outputs a list of all the files which are present in BBS-PC!'s download
  348.     directories, but are not present in the file catalogue. The output is as
  349.     specified using FORMAT, but only some of the options are applicable. In
  350.     particular, the following are valid:
  351.  
  352.             %d  Disk filename
  353.             %c  Descriptive text saying what directory the file is in
  354.             %f  Full disk filename
  355.             %n  The disk filename again
  356.             %p  Disk pathname
  357.             %x  File size in bytes
  358.             %k  File size in K
  359.             %w  Date file was last modified
  360.  
  361.     These have been chosen so that the default output format will list the
  362.     files in a sensible fashion.
  363.  
  364.     This command can be useful if you want to track down all files which
  365.     are not directly related to the bulletin board. For example, the
  366.     following script generates an AmigaDOS script to move all the non-BBS
  367.     files into a common directory called Random on DH1:
  368.  
  369.         #
  370.         # Script to move all files not related to the BBS-PC! file
  371.         # catalogue out of the download directories.
  372.         #
  373.         CHECKFILES      # Check all files
  374.         ECHO ";\n; AmigaDOS script to cleanup BBS file directories\n;"
  375.         FORMAT "copy %f to dh1:random\ndelete %f\n"
  376.         OPEN ram:execute.script
  377.         FOREIGN
  378.         CLOSE
  379.  
  380.     When you run this, the output is a script in RAM: which you can then
  381.     execute using the AmigaDOS Execute command. Alternatively, you could
  382.     add the command EXEC "Execute RAM:execute.script" to the end of the
  383.     above script, and then the script itself would move the files.
  384.  
  385.  
  386. FORMAT "string" [NOLINE]
  387.  
  388.     Determines the format of each line printed by the LIST command. The
  389.     format string is very similar to that used by C's printf() function. It
  390.     contains normal characters, plus any of the following special symbols:
  391.  
  392.         %a      Number of times file has been accessed
  393.         %b{}    File type {Binary,Text}
  394.         %c      Comment associated with file
  395.         %d      Filename the file is stored under on disk
  396.         %f      Full pathname of the disk copy of the file
  397.         %i{}    File status {Online,Offline}
  398.         %k      File size in K
  399.         %l{}    File origin {Local,Remote}
  400.         %n      Filename as it appears in the file database
  401.         %o      Uploader's name (owner)
  402.         %p      Path of the directory containing the file on disk
  403.         %r      Directory number
  404.         %s      Section name
  405.         %ux     Produce underline using x as underline char
  406.         %v{}    File contents {Valid,Invalid}
  407.         %w      Upload date (when)
  408.         %x      File size
  409.         %y      Number of the disk directory the file is stored in
  410.         %{...}  Format substring
  411.  
  412.     A number may optionally be placed between `%' and the appropriate
  413.     character. This will cause the output value of the symbol to be padded
  414.     or truncated to that width. By default, the output is aligned to the
  415.     left but if the number is prefixed with `-', output is aligned to the
  416.     right.
  417.  
  418.     Symbols followed by {} are boolean values, which can be either TRUE or
  419.     FALSE. When such a symbol appears in the format string, it should be
  420.     immediately followed by two substrings enclosed in { and } and separated
  421.     by a comma. If its value is TRUE, then the first substring is used; else,
  422.     the second substring is used. For example, if you want to make a list of
  423.     files, and say whether each one is valid or invalid, you might use:
  424.  
  425.         "%20n%v{,(Invalid)}"
  426.  
  427.     which would print each filename, and if it was invalid, would follow it
  428.     with the string "(Invalid)", starting in Column 20. If the file was
  429.     valid, only the filename would be printed.
  430.  
  431.     A special option is `%{', which allows you to format a substring within
  432.     the main string. This can be of value if you want to have several items,
  433.     one after the other with no gaps between each, but with the total width
  434.     of all the items not exceeding a set width. What occurs inside the
  435.     braces after `%' can be any valid format string, which could itself
  436.     contain `%{}'s (though it's hard to think of a situation where you would
  437.     need to do this). So, "%40{%s,%r,%o}" would print the section, directory
  438.     number and owner name one after the other, with the total being padded
  439.     or truncated to 40 characters.
  440.  
  441.     The other unusual option is `%u', which reproduces the character
  442.     following it a number of times equal to the length of the last string
  443.     output using FORMAT. If `%{...}' has just been used, then the length of
  444.     the substring is used instead. This is handy if you want to underline
  445.     something but are not sure how long it is (or you just want to save some
  446.     typing). For example, to underline a filename, you could use:
  447.  
  448.         FORMAT "%{%n}\n%u-"
  449.  
  450.     This outputs the filename as a substring (thus remembering the length),
  451.     and a newline, and then underlines the filename using ------. When using
  452.     `%u', the "length" number that can appear between the `%' and the format
  453.     character has a slightly different meaning. `%6u' outputs an extra 6
  454.     underline characters, and `%-6u' outputs 6 fewer characters.
  455.  
  456.     The `%i' and `%v' options only make sense if the CHECKFILES command has
  457.     been given earlier. They indicate whether or not the file is online and
  458.     whether it is valid. A file is online if it can be found in any of
  459.     BBS-PC!'s file directories. It is valid if its filesize on disk matches
  460.     its filesize in the file catalogue. If it doesn't, then there is a good
  461.     chance it has been corrupted.
  462.  
  463.     The `%y' option gives the number of the disk directory in which the
  464.     file is stored. This is the position of the disk directory as it
  465.     appears in BBS-PC!'s CFGINFO.DAT file. In particular, the "new uploads"
  466.     directory is numbered 0. (Note that this is different to the directory 0
  467.     in which all uploads are located within BBS-PC!).
  468.  
  469.     The following escape sequences can also appear in the format string:
  470.  
  471.         \n      End of line
  472.         \e      Escape
  473.         \E      CSI (0x9b)
  474.         \t      Tab
  475.         \nnn    Octal number with the appropriate value
  476.  
  477.     Any other characters after a `\' are treated as normal. This can be used
  478.     to escape certain characters that have special meaning, such as `\'
  479.     itself and `%'. `\{' and `\}' do not work within `{...}' (for boolean
  480.     values and substrings) unfortunately. If you are giving the format
  481.     string from the command line and you are using a DOS shell other than
  482.     the CLI, you might need to type `\\' in order to get the shell to pass a
  483.     single `\' to BBSindex. Note that while `\E' can be useful for
  484.     generating ANSI colour codes (as in `\E33m' to change the colour to
  485.     colour 3 for example), BBS-PC! does not recognise `\E', even though
  486.     AmigaDOS does. Hence, for public BBS files, you are better off using
  487.     `\e[33m' which gives the same effect. For more details on ANSI escape
  488.     sequences, see the BBS-PC! or AmigaDOS manuals.
  489.  
  490.     By default, a newline is automatically added to the format string. This
  491.     can be overridden by including the NOLINE parameter after the string.
  492.  
  493.     The default output format string is
  494.  
  495.         FORMAT "%15n %w %-6x-%b{B,T}  %c"
  496.  
  497.     This produces a file listing which is idetical to the listing BBS-PC!
  498.     gives when you ask for a file catalogue.
  499.  
  500.  
  501. IGNORE Filename Filename ...
  502.  
  503.     Specifies a list of files to ignore when CHECKFILES is executed. If you
  504.     have some files in the file catalogue which are updated by external
  505.     programs, their filesizes are likely to differ from the filesizes
  506.     recorded in the BBS-PC! file catalogue. By listing such files here, you
  507.     can tell CHECKFILES that it is okay for the filesizes to be different
  508.     and they will then be marked as valid (and hence won't appear in any
  509.     operations you do on invalid files).
  510.  
  511.     You can use multiple IGNORE commands if you have a lot of files falling
  512.     into this category; however, only IGNORE commands which occur before
  513.     CHECKFILES have any effect.
  514.  
  515.  
  516. LIST
  517.  
  518.     Scans through the the file catalogue (as sorted using SORT) and outputs
  519.     the list of files which match the criteria specified with SELECT,
  520.     according to the format string defined using FORMAT. Output is sent to
  521.     the current file (opened with OPEN) or if none exists, to the screen.
  522.  
  523.     In addition, some internal counters are updated. These counters record
  524.     the number of files listed and the total number of bytes occupied by
  525.     those files. A seperate set of counters record the total number of files
  526.     listed since the start of the script (or the last RESET command). This
  527.     is useful for building cumulative totals. See the ECHO command for more
  528.     details.
  529.  
  530.  
  531. MACRO name
  532.   command 1
  533.   command 2
  534.     ...
  535. ENDM
  536.  
  537.     Defines a macro command. When this command is used later on, it gets
  538.     replaced by the list of commands between the MACRO and ENDM markers.
  539.     The macro text can contain the special symbols $1 to $9 which will
  540.     expand to the parameters given to the command. For example, a macro to
  541.     sort and list the files in a specified directory in a given section
  542.     might look like this:
  543.  
  544.         MACRO Listdir  # Section, Directory, Descriptive Text
  545.           MSG "$2, " noline
  546.           ECHO "%{$2. $3}\n%u-" # Display header, and underline it
  547.           SELECT Section = $1 AND Directory = $2
  548.           LIST
  549.         ENDM
  550.  
  551.     To use this, you would then give a command like:
  552.  
  553.         Listdir 1, 4, "General Files"
  554.  
  555.     to list the files in Directory 4 of Section 1. Note that the comma is
  556.     optional (it gets turned into a space internally anyway) but can make
  557.     things more readable. Also note that any text surrounded by quotes has
  558.     the quotes removed (but the text case retained) when it is substituted.
  559.     This is to allow $ substitution to occur within strings in the macro
  560.     without getting lots of extra quotes everywhere. If you need to get a $
  561.     itself inside the macro, you can use `$$'. In fact, `$' followed by any
  562.     non-numeric character will simply return that character.
  563.  
  564.     Macros are a very powerful feature; used sensibly, they can reduce the
  565.     size of your script files by a significant amount, allowing you to
  566.     express a complicated sequence of commands in only a single line. If you
  567.     have many command sequences which are very similar, it is well worth
  568.     taking the time to learn to use macros effectively.
  569.  
  570.  
  571. MSG "string" [NOLINE]
  572.  
  573.     Outputs "string" just like the ECHO command, except that the string
  574.     always goes to the screen, even when an output file is open. This
  575.     provides a useful way to print informative messages saying what is
  576.     happening, while processing a big script.
  577.  
  578.  
  579. NOREQUEST
  580.  
  581.     Stops AmigaDOS from putting up requesters when it can't find a disk
  582.     volume, or when a disk error occurs. This can be useful if you are
  583.     running BBSindex in a batch environment, where you most likely won't be
  584.     around to click Retry or Cancel in the requester. It is also useful if
  585.     you are running BBSindex remotely (from within BBS-PC! as a menu option).
  586.  
  587.  
  588. OPEN Filename
  589.  
  590.     Opens a new file for output. Any output from BBSindex will be directed
  591.     to this file until it is closed. When no file is open, output goes to
  592.     the screen. If a file is already open when this command is given, then
  593.     it will be closed before the new file is opened.
  594.  
  595.  
  596. RESET
  597.  
  598.     Resets the counters used by the %B, %K, %M and %N options of the ECHO
  599.     command. See the descriptions of SCAN and ECHO for more details.
  600.  
  601.  
  602. SCAN
  603.  
  604.     Scans the file database, counting files that match the SELECT criteria
  605.     just like LIST. Unlike LIST, it doesn't produce any output.  It does
  606.     however update the counters which keep track of the number of files
  607.     printed. This is very useful if you want to produce a file listing which
  608.     displays the number of files in the system at the start of the file,
  609.     followed by the files themselves. You can do that as follows:
  610.  
  611.         SCAN
  612.         ECHO "Amiga BBS File Catalogue, a total of %n files are online\n\n"
  613.         LIST
  614.  
  615.     SCAN counts the files so that %n will be the correct number in the ECHO
  616.     command, and then LIST actually lists them. Of course, if you wanted to
  617.     print the number of files at the bottom of the list, the LIST command
  618.     by itself would be adequate, and you would not need to use SCAN.
  619.  
  620.  
  621. SELECT expression
  622.  
  623.     Selects which files should be printed on the screen when the LIST
  624.     command is given. The expression you give can include any of the
  625.     keywords recognised by the SORT command, plus the boolean operators
  626.     AND, OR and NOT, and the special keyword ALL (which is always true). In
  627.     addition, the keywords Text, Remote, Offline and Invalid are recognised
  628.     as opposites to Binary, Local, Online and Valid.
  629.  
  630.     The following arithmetic operators are supported:
  631.  
  632.         =   <>    >    <    >=   <=
  633.  
  634.     These can be combined together with strings and numbers and grouped
  635.     with parenthesis to produce a full expression. During LIST, any files
  636.     which match the expression are listed. For example, to select all the
  637.     binary files in Section 3, and Directories 4-10, you could use
  638.  
  639.         SELECT Section = 3 AND Directory >= 4 AND Directory <= 10 AND Binary
  640.  
  641.     Note that the eight boolean fields (Binary, Text, Online, Offline,
  642.     Local, Remote, Valid and Invalid) don't need to be tested against
  643.     anything, since they already evaulate to a boolean result. For example,
  644.     Local will evaluate to TRUE if the file being checked was uploaded
  645.     locally.
  646.  
  647.     For date comparisons, recent dates are treated as being "larger"
  648.     than older dates. For example, to list all files uploaded during
  649.     December of 1989, you could say
  650.  
  651.         SELECT Date >= "01-Dec-89" AND Date <= "31-Dec-89"
  652.  
  653.     String comparisons are case insensitive, and standard wildcards are
  654.     supported. A `?' in a string will match any single character, and a `*'
  655.     will match any number of characters (including none). For example
  656.  
  657.         SELECT Name = "*.ZOO" AND Section = 3
  658.  
  659.     selects all the zoo files in section 3. The pattern "?????" would match
  660.     all names five characters long. If you wanted to select all the files
  661.     which were archived using a common file archiver, you might use:
  662.  
  663.         SELECT Name = "*.ZOO" OR Name = "*.ARC" OR Name = "*.LZH"
  664.  
  665.     If you want to use <, >, <= and >= with wildcard matching, you need to
  666.     be careful. Bear in mind that < and > exclude exact matches, whereas
  667.     <= and >= include exact matches. As an example, let's see use a file
  668.     called "FOO". The comparison "FOO" < "F*" is not particularly well
  669.     defined, but will probably be FALSE. On the other hand, "FOO" <= "F*"
  670.     will always evaluate to true, since the `=' portion is true.
  671.  
  672.     Let's finish off with some more examples of selections. To select all
  673.     the text files in section 3, you could use:
  674.  
  675.         SELECT Section = F and Text
  676.  
  677.     Now, let's select all the binary files in section 3, and also all the
  678.     text files in section 3 that end with .ZOO or .ARC (such a requirement
  679.     might come about because some versions of BBS-PC! have a bug which
  680.     makes ZMODEM uploads look like Text files):
  681.  
  682.         SELECT Section = 3 and (Binary or Name = "*.ZOO" or Name = "*.ARC")
  683.  
  684.     As a final note, be aware that the more complicated the expression, the
  685.     longer it will take to do a LIST (or SCAN). You can help speed things
  686.     up by arranging that the condition most likely to be FALSE is at the
  687.     front of the expression. For example, use
  688.  
  689.         SELECT Size > 102400 and Name <> *.ZOO
  690.  
  691.     when selecting all non-ZOO files in the system greater than 100K, rather
  692.     than the other way around.
  693.  
  694.  
  695. SORT index [, index, index ...]
  696.  
  697.     Sorts the file list into an order determined by the list of indices
  698.     given. When output is being generated, it is sorted according to the
  699.     indices specified here. The following indices are valid:
  700.  
  701.         Access      Number of times a file has been accessed (number)
  702.         Binary      Whether the file is binary or text (boolean)
  703.         Comment     File comment (string)
  704.         Date        Upload date (date)
  705.         Directory   Directory number (number)
  706.         DiskDirNum  Number of the file directory on disk (number)
  707.         DiskName    Name of the file on disk (string)
  708.         KSize       File size in K (number)
  709.         Local       Whether the file was uploaded locally (boolean)
  710.         Name        File catalogue name (String)
  711.         Online      Whether the file is online (boolean)
  712.         Owner       Uploader's name (String)
  713.         Pathname    Pathname of disk file (String)
  714.         Section     Section number (number)
  715.         Size        File size in bytes (number)
  716.         Valid       Whether the filesize is valid (boolean)
  717.  
  718.     Each index can optionally by followed by a `+' or `-', to indicate the
  719.     direction of sorting. The default (+) is to sort in ascending order.
  720.     Descending order is selected using `-'. As many indices as are listed
  721.     are considered significant while sorting.
  722.  
  723.     The default sorting order is Name which sorts files by name. An
  724.     alternative index might be Section, Directory, Name which would sort
  725.     the files into seperate sections, then into seperate directories within
  726.     each section, and finally into alphabetical order within each directory.
  727.  
  728.     You can sort files into chronological order by using Date as the sort
  729.     key, or into reverse chronological order (i.e. newest files first) by
  730.     using Date- as the key.
  731.  
  732.     Note that the CHECKFILES command sorts the database into alphabetical
  733.     order by disk name before it starts scanning the disk. If you have given
  734.     a SORT command before this, then CHECKFILES will sort the files a second
  735.     time back into the order you specified. You can avoid the time overhead
  736.     this involves (which is not actually that much) by not using SORT until
  737.     after CHECKFILES.
  738.  
  739.  
  740. TRACE [ON | OFF]
  741.  
  742.     Turns on or off trace mode. When tracing is turned on, all the commands
  743.     thereafter will be output to the screen before they are executed. This
  744.     can be useful for tracking down a problem with a script. In particular,
  745.     the commands which make up a macro will be printed individually each
  746.     time the macro is executed, with $1 to $9 replaced by the actual
  747.     parameters. Constants will also be replaced by their current value.
  748.     Tracing can be turned on globally by specifying the -t option on the
  749.     command line; TRACE ON and TRACE OFF are most useful when you have a
  750.     large script file and you don't want to have to trace through all of it.
  751.  
  752.  
  753. HISTORY
  754.  
  755.     V0.99   Initial beta release. Several bugs, and a few inconsistencies.
  756.  
  757.             - Vigilant beta testers proved that nothing works first time :-)
  758.             - Kudos to Lattice's catch.o for making life a bit more bearable
  759.               (and also to CodeProbe of course).
  760.  
  761.     V1.0    First official release.
  762.  
  763.             - Improved memory allocator to handle small requests by
  764.               allocating a large chunk and working from that. This should
  765.               help decrease memory fragmentation.
  766.             - Added support for constants
  767.             - Added IGNORE keyword to allow "dynamic" files to avoid being
  768.               marked as invalid.
  769.             - Reworked the documentation a bit, so that it wasn't quite as
  770.               disorganised.
  771.             - Toyed with the idea of allowing scripts to be specified on
  772.               the command line (like sed) but decided wasn't worth the
  773.               effort for now.
  774.  
  775.  
  776. DISTRIBUTION
  777.  
  778.     BBSindex may be freely distributed for non-commercial purposes, as long
  779.     as no profit is made from doing so. It may be distributed with
  780.     commercial software only with the express written agreement of the
  781.     author. Specific permission is granted to Fred Fish to include BBSindex
  782.     in his fine public domain library.
  783.  
  784.  
  785. AUTHOR
  786.  
  787.     Please direct any praise, criticism, general suggestions or
  788.     large sums of money to:
  789.  
  790.     Eddy Carroll
  791.     ecarroll@vax1.tcd.ie (Trinity College, Dublin, Ireland)
  792.  
  793.     Also, please feel welcome to pay a visit to Infomatique BBS, of
  794.     which I am a co-sysop:
  795.  
  796.         Phone:   +353-1-302970  (Ireland)
  797.         Speeds:  V21/22bis/23
  798.         Times:   24 hours/day
  799.  
  800.     110 Megs of online storage, large Amiga and IBM file database.
  801.     Membership is free. If you call, mention where you got the number.
  802.